import router from "./router"
import { getLocalToken } from "./utils/auth"

const whiteList = ['/login', '/404']
router.beforeEach((to, from, next) => { 
    const token = getLocalToken()
    if (token) {
        next()
    } else{
        if (whiteList.includes(to.path)) {
            // 在白名单内
            next()
        } else {
            next('/login')
        }
    }
})